package cn.trigram.validation.annotation.validator;

import cn.trigram.lang.ConvertUtil;
import cn.trigram.validation.annotation.EnumValueCheck;
import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;

public class EnumValueForShortValidator extends AbstractEnumValueValidator implements ConstraintValidator<EnumValueCheck, Short> {

    @Override
    public void initialize(EnumValueCheck constraintAnnotation) {
        super.initialize(constraintAnnotation);
    }

    @Override
    public boolean isValid(Short value, ConstraintValidatorContext context) {
        return super.isValid(ConvertUtil.toStr(value), context);
    }
}
